<?php

	class Orders_model extends CI_Model {

		protected $__tbname = 'orders';
		protected $__dbconf = 'default';

		var $id;	//bigint(20) unsigned	Primary Key	Auto Increment	NOT NULL
		var $id_campaign;	//bigint(20) unsigned			NOT NULL
		var $id_order_coeff;	//int(10) unsigned			NOT NULL
		var $status = 1;	//tinyint(1) unsigned			NOT NULL
		var $id_user;	//bigint(20) unsigned			NOT NULL
		var $is_deleted = 0;	//tinyint(1) unsigned			NOT NULL
		var $price = 0;	//float unsigned			NOT NULL

		protected $__validation_rule = array(
			'id' => array('key' => 'PRI', 'type' => 'bigint', 'null' => FALSE, 'auto_increment' => TRUE),
			'id_campaign' => array('type' => 'bigint', 'null' => FALSE),
			'id_order_coeff' => array('type' => 'int', 'null' => FALSE),
			'status' => array('type' => 'tinyint', 'null' => FALSE),
			'id_user' => array('type' => 'bigint', 'null' => FALSE),
			'is_deleted' => array('type' => 'tinyint', 'null' => FALSE),
			'price' => array('type' => 'float unsigned', 'null' => FALSE)
		);

		protected $__relation = array(
			array('table' => 'campaign', 'foreign_key' => 'id_campaign'),
			array('table' => 'order_coeff', 'foreign_key' => 'id_order_coeff'),
			array('table' => 'user', 'foreign_key' => 'id_user')
		);
	}
